package com.yuanchu.store.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.yuanchu.common.validator.ValidationGroups;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-03-03 23:59
 */
@Data
public class DeliveryParamsDto implements Serializable {
    @NotNull(message = "deliveryId不能为空", groups = {ValidationGroups.Update.class, ValidationGroups.Delete.class})
    private Integer deliveryId;
    private ExpressForm form;

    @Data
    public static class ExpressForm implements Serializable  {
        private String name;
        private Integer method;
        private Integer sort;
        private List<RulesForm> rules;
    }

    @Data
    public static class RulesForm implements Serializable  {
        private Integer key;
        private Double first;
        @JsonProperty("first_fee")
        private String firstFee;
        private Double additional;
        @JsonProperty("additional_fee")
        private String additionalFee;
        private List<Integer> region;
        @JsonProperty("region_text")
        private List<RegionTextForm> regionText;
        @JsonProperty("rule_id")
        private Integer ruleId;
        @JsonProperty("create_time")
        private String createTime;
        @JsonProperty("delivery_id")
        private Integer deliveryId;
    }

    @Data
    public static class RegionTextForm implements Serializable  {
        private String name;
        private List<String> citys;
    }
}
